var mongoose = require('mongoose')
var db = require('../../server/db')

var modelName = 'user'

var schema = new mongoose.Schema({
    name: {type: String, request: true, unique: true},
    password: {type: String, default: ''},
    avatarUrl: {type: String, default: ''},
    introduction:{type: String, default:  '这个人很懒，什么也没留下...'},
    identity: {type: Number, default: 0},  // 0普通用户， 1 管理员 2 超级管理员
    age: {type: Number, default: 0},
    sex: {type: Number, default: 1}, // 1 男 2 女
    fans: [{
        id: {type: mongoose.Schema.ObjectId},
        name: {type: String}
    }],
    care: [{
        id: {type: mongoose.Schema.ObjectId},
        name: {type: String}
    }],
    collectPost:  [{
        id: {type: mongoose.Schema.ObjectId},
        name: {type: String}
    }],
    active: {type: Number, default: 0},
    qq: {type: String, default: ''},
    email: {type: String, default: ''}
}, {timestamps: true})

var model = db.model(modelName, schema)


module.exports = model